/**
 * 
 */
package com.atung.dao;

import java.time.Instant;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.atung.model.RefundDO;

/**
 * 
 * @author lc <br>
 * 2020年11月23日 下午4:37:49
 */
@Mapper
public interface BusOrederCarLCDAO {


    /**
     * 根据订单id和openId获取订单信息
     */
    @Select("SELECT zf.id,zf.open_id,ls.rout_publish_id,zf.order_state,order_status,ls.order_payable_money FROM bus_order_car zf "
            + "LEFT JOIN bus_school_bus_payment ls ON ls.id = zf.payment_id  "
            + "where zf.payment_id =#{num} and zf.open_id =#{openId}")
    RefundDO getById(@Param("num")Long num,@Param("openId") String openId);
    
    @Select("SELECT start_data FROM bus_rout_publish WHERE id = #{id}")
    Instant getRouteStartTime(Long id);
    
    /**
     * 修改流水单状态为退款中
     */
    @Update("UPDATE bus_school_bus_payment SET order_status = 206 where id = #{id} ")
    Boolean updatePublishRefund(Long id);
    /**
     * 修改支付订单状态为退款中
     */
    @Update("UPDATE bus_order_car SET order_state = 304 where payment_id = #{id} ")
    Boolean updateOrderRefund(Long id);
    
}
